package com.example.blogindex.web;

import com.example.blogindex.web.Fengin.OtherFengin;
import com.xpd.blog.bean.Result;
import com.xpd.blog.bean.Typeinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("type")
public class TypeController {

    @Autowired
    OtherFengin otherFengin;
    @RequestMapping("getAllType")
    List<Typeinfo> getAllType(){
        return  null;
    }

    //分页查询类别
    @RequestMapping("getAlltypeBypage")
    public Result getAlltypeBypage(@RequestParam int page, @RequestParam int size, @RequestParam String searchUname){
        Result alltypeBypage = otherFengin.getAlltypeBypage(page, size, searchUname);
        return  alltypeBypage;
    }

    //添加类别
    @RequestMapping("/addType")
    public Result addType(@RequestParam String searchUname){
        Result result = otherFengin.addType(searchUname);
        return result;
    }

    //删除类别
    @RequestMapping("delType")
    public Result delType(@RequestParam int tid){
        Result result = otherFengin.delType(tid);
        return result;
    }
    //修改类别
    @RequestMapping("updateType")
    public Result updateType(@RequestBody Typeinfo typeinfo){
        Result result = otherFengin.updateType(typeinfo);
        return result;
    }



}
